/**
 入驻小区
 **/
(function(vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            aOwnerDetailAcctReceiptInfo: {
                feeReceipts: [],
                ownerId: '',
                total: '',
                records: '',
                selectReceipts: [],
                quan: false,
            }
        },
        _initMethod: function() {},
        _initEvent: function() {
            //切换 至费用页面
            vc.on('aOwnerDetailAcctReceipt', 'switch', function(_param) {
                if (_param.ownerId == '') {
                    return;
                }
                 $that.aOwnerDetailAcctReceiptInfo.ownerId = _param.ownerId;
                $that._listAOwnerDetailAcctReceipt(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('aOwnerDetailAcctReceipt', 'paginationPlus', 'page_event',
                function(_currentPage) {
                    $that._listAOwnerDetailAcctReceipt(_currentPage, DEFAULT_ROWS);
                });
        },
        methods: {
            _listAOwnerDetailAcctReceipt: function(_page, _rows) {
                let param = {
                    params: {
                        page: _page,
                        row: _rows,
                        ownerId: $that.aOwnerDetailAcctReceiptInfo.ownerId,
                    }
                };
                //发送get请求
                vc.http.apiGet('/receipt.listAdminAccountReceipt',
                    param,
                    function(json, res) {
                        let _json = JSON.parse(json);
                        $that.aOwnerDetailAcctReceiptInfo.total = _json.total;
                        $that.aOwnerDetailAcctReceiptInfo.records = _json.records;
                        $that.aOwnerDetailAcctReceiptInfo.feeReceipts = _json.data;
                        vc.emit('aOwnerDetailAcctReceipt', 'paginationPlus', 'init', {
                            total: $that.aOwnerDetailAcctReceiptInfo.records,
                            dataCount: $that.aOwnerDetailAcctReceiptInfo.total,
                            currentPage: _page
                        });
                    },
                    function(errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _queryFeeAccountReceiptMethod: function() {
                $that._listAOwnerDetailAcctReceipt(DEFAULT_PAGE, DEFAULT_ROWS);
            },
        }
    });
})(window.vc);